package io.gitee.zicai.stream.config

import org.springframework.amqp.core.*
import org.springframework.context.annotation.Bean
import org.springframework.context.annotation.Configuration

/**
 * RabbitMQConfig
 * @author zicai
 * @since 2020-05-14
 */
@Configuration
open class RabbitMQConfig {

    @Bean
    open fun exchange(): Exchange {
        return TopicExchange("amqp-test-exchange")
    }

    @Bean
    open fun queue(): Queue {
        return Queue("amqp-test-queue")
    }

    @Bean
    open fun binding(exchange: Exchange, queue: Queue): Binding {
        return BindingBuilder.bind(queue).to(exchange).with(queue.name).noargs()
    }
}